Socket
Socket
Sign inDemoInstall

ejs-prerender

Package Overview
Dependencies
27
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ejs-prerender

A tool for structured pre-rendering of EJS templates and partials


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ejs-prerender

Usage

This package is typically used as a devDependency. Install by running npm i -D ejs-prerender. It can be used as an npm script like the following:

"build:templates": "ejs-prerender",

and run manually using npx:

npx ejs-prerender

This package utilizes the debug library, so adding DEBUG=ejs-prerender:* to a .env file or the command path (DEBUG=ejs-prerender:* npx ejs-prerender) will enable logging of everything.

The following file structure works out-of-the-box with no customized environment variables.

root
├ components/
│ └ head.ejs
└ pages/
  ├ about/
  │ └ index.ejs
  └ index.ejs

will render as

root
└ public/
  ├ about/
  │ └ index.html
  └ index.html

The components can be simply referenced inside EJS pages as seen below:

<!DOCTYPE html>
<html>
  <head>
    <%- include('head') -%>
  </head>
  <body><h1>INDEX</h1></body>
</html>

Configuration

Environment Variables

OptionEnvironment VariableTypeDefaultDescription
baseDirPEJS_BASE_DIRStringcurrent working directoryBase directory to reference for other relative paths
outputDirPEJS_BUILD_OUTPUT_DIRString'public'Where the completed pages get written
componentsDirPEJS_BUILD_COMPONENTS_DIRString'components'Where components live
pagesDirPEJS_BUILD_PAGES_DIRString'pages'Where pages live
pageExtensionPEJS_BUILD_PAGES_EXTString'ejs'File extension of pages

Keywords

FAQs

Last updated on 28 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc